from django.contrib import auth
from django.core.paginator import Paginator
from rest_framework.authtoken.models import Token
from backend.models import Performance, User, Project, Service, Research, Argument, \
    Achievement
from .util import *
from ..model.project import *


def projects(request):
    user_id = request.session.get('user_id')
    user = User.objects.get(id=user_id)
    if not user:
        return format_response(NOT_LOGIN)
    extra, project_list = get_projects_head_user_detail(user_id)
    data = {
        "head_user": user.get_full_name(),
        "all_score": extra.get('all_score'),
        "all_num": extra.get('all_num'),
        "list": project_list
    }
    return format_response(SUCCESS, data)
